package com.app.acitivty;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.AdapterView.OnItemClickListener;

import com.app.activity.R;
import com.app.adapter.ADlistAdpter;
import com.app.components.TopMenu;
import com.app.data.DataGeneration;
import com.app.data.InnItem;
import com.app.data.ListDataModel;
import com.app.data.ScenicItem;
import com.app.utils.ActivityTools;

public class ScenicListActivity extends Activity {

	private ArrayList<HashMap<String, String>> mScencListItems = null;

	private String[] mColumnNames = { "scenicIcon", "senicName", "senicPrice",
			"senicIntro", "senicSubject" };

	private int[] mViewIds = { R.id.imgScenicIcon, R.id.tvSenicName,
			R.id.tvSenicPrice, R.id.tvSenicIntro, R.id.tvSenicSubject };

	private ListView lvSceniclist;

	private Button btnFootSearch;

	private LinearLayout linearLayout;

	private void initView() {
		lvSceniclist = (ListView) findViewById(R.id.lvScenicList);
 

	}

	@SuppressWarnings("rawtypes")
	public static HashMap addItem(ScenicItem item) {
		HashMap<Object, Object> map = new HashMap<Object, Object>();
		map.put("scenicIcon", item.getScenicIcon());
		map.put("senicName", item.getSenicName());
		map.put("senicPrice", item.getSenicPrice());
		map.put("senicIntro", item.getSenicIntro());
		map.put("senicSubject", item.getSenicSubject());
		return map;
	}

	@SuppressWarnings("unchecked")
	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.scenic_list);
		initView();
		TopMenu topMenu = new TopMenu(this, "门票", new OnClickListener() {

			@Override
			public void onClick(View v) {
				ScenicListActivity.this.finish();
				// // 跳转到预定页面
				// ActivityTools.gotoActivity(ScenicListActivity.this,
				// ScenicScheduledActivity.class);
			}
		}, R.drawable.top_button_unselect, R.drawable.top_button_selected,
				"景点列表");
		topMenu.onCreate();

		mScencListItems = new ArrayList<HashMap<String, String>>();

		for (int i = 0; i < 7; i++) {
			ScenicItem si = new ScenicItem();
			si.setScenicIcon(R.drawable.scen_logo);
			si.setSenicName("丽江虎跳峡");
			si.setSenicPrice("￥133起");
			si.setSenicIntro("虎跳峡,中国最深的峡谷之一，在云南省玉龙纳西族自治县...");
			si.setSenicSubject("主题：生态旅游  休闲  生态旅游");
			mScencListItems.add(addItem(si));
		}

		ListAdapter la = new SimpleAdapter(this, mScencListItems,
				R.layout.scenic_list_item, mColumnNames, mViewIds);
		lvSceniclist.setAdapter(la);
		lvSceniclist.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				ActivityTools.gotoActivity(ScenicListActivity.this, ScenicDetailActivity.class);
				
			}
		});

	}

}
